<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     <title>${message("999")}</title>
     <meta http-equiv="expires" content="0" />
     <meta http-equiv="Pragma" content="no-cache" />
     <meta http-equiv="Cache-Control" content="no-cache" />
      <link rel="icon" href="/resources/images/lock-head-logo.png" type="image/x-icon"/>
     <link href="/resources/css/login.css" rel="stylesheet" type="text/css" />
     <link href="/resources/css/common.css" rel="stylesheet" type="text/css" />
	 <script type="text/javascript" src="/resources/js/reference/jquery.js"></script>
	 <script type="text/javascript" src="/resources/js/base/dialog.js"></script>
	 <script type="text/javascript" src="/resources/js/base/request.js"></script>
	 <script type="text/javascript" src="/resources/js/base/global.js"></script>
     <style>
     .sub-btn:hover{
     	cursor: pointer;
     }
     #isRememberUsername:hover{
     cursor: pointer;
     }
     </style>
<script type="text/javascript">
	 var siteUrl = '${siteUrl}';
	 function getWindow(){
		 var obj=window.self;
		 try{ 
			 for(var i=0;i<10;i++)
			  {
			   var url = obj.window.parent.location.href;
			   if(url.indexOf(siteUrl)>=0){
			   	obj=obj.window.parent;
			   }else{
			   	return obj;
			   }
			 }
		  }catch(e){
	    	return obj;
	      }
	}
	
	try{ 
		if(self!=top){
			if(top.location.href.indexOf(siteUrl)>=0){
				top.location.href=location.href;
			}else{
				var obj = getWindow();
	       		obj.location.href=location.href;
			}
		}
     }catch(e){}
    $().ready( function() {

     
     var $loginForm = $("#loginForm");
     var $enPassword = $("#enPassword");
     var $username = $("#username");
     var $password = $("#password");
     var $companyInfoName = $("#companyInfoName");
     var $captchaImage = $("#captchaImage");
     var $isRememberUsername = $("#isRememberUsername");
     var $login_btn = $(".login_btn");
     
     // 记住用户名
     if(getCookie("memberusername") != null) {
     $isRememberUsername.prop("checked", true);
     $username.val(getCookie("memberusername"));
     [#if company == null]
     $companyInfoName.val(getCookie("membercompanyInfoName"));
     [/#if]
     $password.focus();
     
     } else {
     $isRememberUsername.prop("checked", false);
     $username.focus();
     }


$("form").bindAttribute({
			callbackTime:"fail",
			callback: function(result){
				$("#errorText").text(result.content);
			}
		 });

     // 表单验证、记住用户名
     $loginForm.submit( function() {
	     if ($isRememberUsername.prop("checked")) {
	     	addCookie("memberusername", $username.val(), {expires: 7 * 24 * 60 * 60});
	     	addCookie("membercompanyInfoName", $companyInfoName.val(), {expires: 7 * 24 * 60 * 60});
	     } else {
	     	removeCookie("memberusername");
	     	removeCookie("membercompanyInfoName");
	     }
	     var option = {
	     	url:$loginForm.attr("action"),
	     	method:"post",
	     	data:$loginForm.serialize(),
	     	failCallback:function(result){
	     		$("#errorText").text("* "+result.content);
	     	},
	     	callback:function(message){
	     		location.href= message.objx;
	     	}
	     };
	     ajaxSubmit($(":submit"),option);
	     return false;
	   
	 });

 });
</script>
</head>
<body style="background: url(/resources/images/bg-1.jpg) no-repeat;background-size: cover;">
<div class="login-header" style="background: none;">
	<div class="logo"><b>电子锁管理平台</b></div>
    <!-- <div class="fr selectLag">
	    语言/Language：
	    <select id="language" name="language">
				<option value="">
					请选择/Choose</option>
				<option value="CN" [#if language=="CN"]selected[/#if]>
					中文/Chinese
				</option>
				<option value="en" [#if language=="en"]selected[/#if]>
					英文/English
				</option>
			</select>
    </div> -->
</div>
<div class="login-main" style="width:100%">
	<!--<div class="login-banner">
		<img src="/resources/images/login-banner.png" />
	</div>-->
    <div class="box-form login" style="margin:auto;float:none;">
    	<form id="loginForm" action="/login/submit.jhtml" method="post">
	        <input type="hidden" id="enPassword" name="enPassword" />
	        <input type="hidden" name="language" value="ChinaCN" />
	    	<div class="txt user"><input type="text" placeholder="用户名" name="username" id="username"/></div>
	        <div class="txt password"><input type="password" placeholder="密码" name="password" /></div>
	        <div class="txt business"><input type="text" placeholder="企业编号、企业简称或全称" name="companyName" id="companyInfoName" [#if company??]value="${company}" readonly[/#if]/></div>
			<label><input type="checkbox" id="isRememberUsername" value="true" > 记住用户名</label>
	    	<input type="submit" class="btn sub-btn" value="登录" />
	    	<div id="errorText"></div>
    	</form>
    </div>
    <div style="clear:both;"></div>
    
</div>
</body>
</html>
